import axios from 'axios';
import { constants } from '../store';

const changeHomeDataAction = (result) => ({
  type: constants.CHANGE_HOME_DATA,
  topicList: result.topicList,
  listList: result.listList,
  RecommendImg: result.RecommendImg
});

export const changHomeData = (dispatch) => {
  return (
    axios.get('/api/homeList.json').then((res)=> {
      const result = res.data.data;
      dispatch(changeHomeDataAction(result))
    })
  )
}
export const loadMore = (currentListPage) => ({
  type: constants.LOAD_MORE,
  currentListPage
})
export const changeScroll = (showScroll) => ({
  type: constants.CHANGE_SCROLL,
  showScroll
})
